UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iNCHekZDtt/0Rs7+nmweyRc/y9c4PTWMwpuiJqNkk5Y=' 
WHERE 
  key_id = 'a4bc714df74039f67985cddeacf92dc59f4bdfe940d4ccd8f24d0c40845ebe47' 
  AND (
    token = 'iNCHekZDtt/0Rs7+nmweyRc/y9c4PTWMwpuiJqNkk5Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016