UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M5aD1flXusqMZwP7c4RSrZl4ZmvU+feDV/pGzq1HVLk='
WHERE
key_id = 'c6f2402b39a52bf6156446670a69d6839b0b77a5c3fda4bfd11362f71ec8eb5d'
AND (
token = 'M5aD1flXusqMZwP7c4RSrZl4ZmvU+feDV/pGzq1HVLk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)