UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M10N3C0S/2ehwP/VvMUIqWQWvMWYN7wuuL/NIU4Mwuw=' 
WHERE 
  key_id = 'fe2b3473384b0a0319384fdcdfd5e761bddfc94f504fddb7ed9f89fb882505dc' 
  AND (
    token = 'M10N3C0S/2ehwP/VvMUIqWQWvMWYN7wuuL/NIU4Mwuw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016