UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ioo1g2uGkU2e0GeAXOIY+VLtCbMdwJANQShwvP/qEac=' 
WHERE 
  key_id = '12c279f1fd8696daffdce4c3ab963b1a45850e2e35af1ea808a45e09a1dcddd9' 
  AND (
    token = 'Ioo1g2uGkU2e0GeAXOIY+VLtCbMdwJANQShwvP/qEac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021