UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '58yB7dsBYWEDsTliwR4sLh0MKnVn7tYIP4Xt8yrY8JM='
WHERE
key_id = 'ab76f31b00e4e8688447a94ebaf54b0eb1dbaed69583502a96812e33da719a4a'
AND (
token = '58yB7dsBYWEDsTliwR4sLh0MKnVn7tYIP4Xt8yrY8JM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)