UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/YuRmNwCD4dA1ykZXXstPwTOca1jQuM1tUOqbVAWKyg='
WHERE
key_id = 'b89d6b10e846487283502a651c8a269cea856a63e9feda040156073e5474d324'
AND (
token = '/YuRmNwCD4dA1ykZXXstPwTOca1jQuM1tUOqbVAWKyg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)