UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W3edhPktgAG8B77SW5uHR7NX7qKHoGB4I6761OTgV+c='
WHERE
key_id = '39df7afcf845b0e65577ff62cf676b826cb466dd90e4b7084e1828ab78947c33'
AND (
token = 'W3edhPktgAG8B77SW5uHR7NX7qKHoGB4I6761OTgV+c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)