UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nl1dN3GdytUg+wzSoKK6fa0qQuucCAW1Xfx+Tbi187s='
WHERE
key_id = 'e46e31f5a5e1082085483410d018aba642da863d3170aec81f5bc724cfa19ea0'
AND (
token = 'nl1dN3GdytUg+wzSoKK6fa0qQuucCAW1Xfx+Tbi187s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)