UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n1KAv12wJvBfdug7eX++tXLmlTa4BGLANfbPGY+kLAM=' 
WHERE 
  key_id = '524a2205c6d4e4d546d0e75780db01a3d3ffb79ece708abf1fc9e37b0ff15072' 
  AND (
    token = 'n1KAv12wJvBfdug7eX++tXLmlTa4BGLANfbPGY+kLAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043