UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'djywxRiFMRap0gpZHHs0sdpAEwc0dXHR+78ogclKKHA='
WHERE
key_id = '33c1e16e88bfc55a296d7c57978c930763d42fe1bdec8216a7cc8fd5fe168900'
AND (
token = 'djywxRiFMRap0gpZHHs0sdpAEwc0dXHR+78ogclKKHA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)