UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ugT+8kX3WZzb4GmrWjlqZ45kQYYRCFNqoHZJl/Uo2Z8=' 
WHERE 
  key_id = '10528e5ebd8c31ab31dace03cc4598261e3ebb3a949497bff249748f0988aaed' 
  AND (
    token = 'ugT+8kX3WZzb4GmrWjlqZ45kQYYRCFNqoHZJl/Uo2Z8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034