UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eypzw7ftTNeYW1Z8uHxHN8erTynmKZmC5RYdKbak+dI='
WHERE
key_id = '123d44fe431bef6e0407b53aea77153ca2799f587954a1db19f37a573a028317'
AND (
token = 'eypzw7ftTNeYW1Z8uHxHN8erTynmKZmC5RYdKbak+dI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)