UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mSKdVONK2qvcoXTDh/8S/AX4CL923Y2BUbfAu6brX1k='
WHERE
key_id = '3332a0ee18238e62434a73737716bf984ec4b05286a28d5d1cb841c5478f59c0'
AND (
token = 'mSKdVONK2qvcoXTDh/8S/AX4CL923Y2BUbfAu6brX1k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)