UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '61XjCrgLC+jRwS1Oy/APZzWCKRevN5W7zankL76PL/A=' 
WHERE 
  key_id = '05afaba329b69a062fecc1361e97efa99ae67a41b50cd7773712e1f06c85b393' 
  AND (
    token = '61XjCrgLC+jRwS1Oy/APZzWCKRevN5W7zankL76PL/A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023