UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A4Elr8omjJvMTVXQJHWEWx8QNQKza86VkgcVivNEV+w='
WHERE
key_id = '8befbd164c8e460e1425ae19c11ed89f45a79adcd623dbb39bc4565376ac5fed'
AND (
token = 'A4Elr8omjJvMTVXQJHWEWx8QNQKza86VkgcVivNEV+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)