UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XjiE1EuRy+I5lVVCeGmpEl0oANiQCbR+VdRZOvwMYG0='
WHERE
key_id = 'd0e32c9e1140cb556b97fd465ff9d3f2c641c01718bbb51862845080d58a4b8b'
AND (
token = 'XjiE1EuRy+I5lVVCeGmpEl0oANiQCbR+VdRZOvwMYG0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)