UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'F1L1TypZrwrnxj3b/EvddMKn59yLe7SlAY6uQ9+BGhw='
WHERE
key_id = '4e5cd6936d7231e6f397a6f2e80e7b6b1e659f7f8952c040d23cb6a2daa93eaf'
AND (
token = 'F1L1TypZrwrnxj3b/EvddMKn59yLe7SlAY6uQ9+BGhw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)