UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BUbzq0ACxjf/8lCm+j6hnyXYvHqrBazj2DLvOfLfPdw=' 
WHERE 
  key_id = '0162a75ab650ebc78089d4266ecd41e261a72cd7bcc6f0e100a86528ba595f85' 
  AND (
    token = 'BUbzq0ACxjf/8lCm+j6hnyXYvHqrBazj2DLvOfLfPdw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026