UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xRrqntvtthQJDx7GODOM6izi8HTLw7cybzFE3Mmixrw='
WHERE
key_id = '3e2972cc72d4f97814d809751a66103d2a12eeba59fb14a6e08e668f32a1891d'
AND (
token = 'xRrqntvtthQJDx7GODOM6izi8HTLw7cybzFE3Mmixrw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)