UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w3kLqY+WmhayROzZFW4fjOcfbnT6bnNEUC1CvTKJfBE='
WHERE
key_id = '4b7d34d316a672e348ecb67b19d2ca1489759ffa7282724a13cdbdf6191ca49b'
AND (
token = 'w3kLqY+WmhayROzZFW4fjOcfbnT6bnNEUC1CvTKJfBE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)