UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EruZ6aPkgfImB9amEacX/ylR+e5oQeV2Cj9ib0TYlRE=' 
WHERE 
  key_id = 'aafea8aa9a4576ff9f8e70bbd956412176874951972374955f511460a7021bd5' 
  AND (
    token = 'EruZ6aPkgfImB9amEacX/ylR+e5oQeV2Cj9ib0TYlRE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039