UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ak48SooyIKHDHcaqCk9WQyrB1y1fQ5ay/d/HpIl1xC0=' 
WHERE 
  key_id = 'a4af655ef5569035b8e74c67a9b5e3668d9e6d85de37fd41b465e7f8cf917818' 
  AND (
    token = 'Ak48SooyIKHDHcaqCk9WQyrB1y1fQ5ay/d/HpIl1xC0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049