UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L57zVuB4DL7yoHddvU8NoG2YCZJIJcwN7feglyDT2eE='
WHERE
key_id = '49217ff741d558294dc0a9116f15fbb644f407df47ee2e0094092a7dd6e55da4'
AND (
token = 'L57zVuB4DL7yoHddvU8NoG2YCZJIJcwN7feglyDT2eE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)