UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uZv3CGiyjNPKyzXc7Y27SrGBk0+ifcNWk6HscKnLDUI=' 
WHERE 
  key_id = '07be151f489fb1f7c7f14ad7c92177f1120a66477e4a5b659fd325ec715708a9' 
  AND (
    token = 'uZv3CGiyjNPKyzXc7Y27SrGBk0+ifcNWk6HscKnLDUI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059