UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JwuK1F0H4bjXkwaS9MuiigewXST0bJhuQvWpaWw9ts0='
WHERE
key_id = 'e979bbd44c75d48642c4e10e8de8c793f20d297d2cb6645f15d9cdd9090e52bb'
AND (
token = 'JwuK1F0H4bjXkwaS9MuiigewXST0bJhuQvWpaWw9ts0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)