UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4QcEO+a5TGewEMTriDdHsAcWq+c0/I30ZXPRs7zpbOY='
WHERE
key_id = 'd403b11b3633267b98684b968314db67c3991027ed11700399defe58016c1965'
AND (
token = '4QcEO+a5TGewEMTriDdHsAcWq+c0/I30ZXPRs7zpbOY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)