UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sO5Yta/+3/Mgrvj3pzZU/uy1PuReDM/CA2LXu8NHulQ=' 
WHERE 
  key_id = '3fec14e15fd1daf82c7db8f1df9530a9853c31a37dc77b78ef23568d2359f8ef' 
  AND (
    token = 'sO5Yta/+3/Mgrvj3pzZU/uy1PuReDM/CA2LXu8NHulQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018