UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'skiwjSBXrG5JRxkkRxrXUKLwEMI8UiyMMn4Xk4CTTBU='
WHERE
key_id = 'cc82568a422ebd5c8aa6f463df54780999908905d44a0e2185a9a840210851f2'
AND (
token = 'skiwjSBXrG5JRxkkRxrXUKLwEMI8UiyMMn4Xk4CTTBU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)