UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ciwENQrae4ky4PsEwfcbAkOls9MVp33IcEtF90bFyeA='
WHERE
key_id = '987cd062fab3f5d9b9fcd8666d9291ee37781401b154265dc969a4a9b3f9c15b'
AND (
token = 'ciwENQrae4ky4PsEwfcbAkOls9MVp33IcEtF90bFyeA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)