UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zY+4JoNSrKHrKegfN4MRdznkGuq1jW6Zll46eNy5US8='
WHERE
key_id = '4a17cf4ee17d55cb6f7b25ce51b7a38b8d64ca5e1f8dc7e4a767d238de0a31da'
AND (
token = 'zY+4JoNSrKHrKegfN4MRdznkGuq1jW6Zll46eNy5US8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)