UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MbH8O0cJEj7f88pzXMycEs3+kTLbT/lxItE3s6FPl7E=' 
WHERE 
  key_id = '290a9530e5afac6868ef1f14ac6ad38de2bc29c368344a4eec8d15342c39ed9a' 
  AND (
    token = 'MbH8O0cJEj7f88pzXMycEs3+kTLbT/lxItE3s6FPl7E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034