UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D1tM/7Vy5iwWbVUGaXPlkrFys9qPqEX2h/L1xIVwNGM='
WHERE
key_id = 'afd52eec225632e9db4e5f09eee16668dea37fed1b7705a252ac224af99388ad'
AND (
token = 'D1tM/7Vy5iwWbVUGaXPlkrFys9qPqEX2h/L1xIVwNGM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)