UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Tm4TijbF+y7Qj5z5kybPpCuOp7bwd4OkhNdlskTluZU='
WHERE
key_id = '036833e71da86b2cb954df8675fdbd3de0a2abbcd9208b52adde7e3f6704a277'
AND (
token = 'Tm4TijbF+y7Qj5z5kybPpCuOp7bwd4OkhNdlskTluZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)