UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6HaoxNyz2QBCak79at+G27OGJ6uSQwose949W3VEYew='
WHERE
key_id = '6bcebdddddbc1673f044a77667840aa6c85a0480a72d587384d4cabcacad364d'
AND (
token = '6HaoxNyz2QBCak79at+G27OGJ6uSQwose949W3VEYew='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)