UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7MY5OzG0Pv3tvakwacGypd1vVzxvkNHSr8PttGD4Xf4='
WHERE
key_id = 'e02af0ba0941d6433fab1078bb35cdafebb6048ddb6dcc25d736b94e83b972dc'
AND (
token = '7MY5OzG0Pv3tvakwacGypd1vVzxvkNHSr8PttGD4Xf4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)