UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nyBFcLRd9+X6rp16mHOV7Ydkr8y8EOVNXuPBU51d6j8='
WHERE
key_id = '15bdbe26758da57c0d005103be8a912435c3b7f5b791f1d1cdaef7e0ebc365d1'
AND (
token = 'nyBFcLRd9+X6rp16mHOV7Ydkr8y8EOVNXuPBU51d6j8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)