UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qaat8ppkjqtIOy+g/RKJSfv1GANCRCrvML+iTNt3Csk=' 
WHERE 
  key_id = '6df00a7c3a919f987e89e269239f48fbcc5ac0c9b3010939d730fa38d6406fd5' 
  AND (
    token = 'qaat8ppkjqtIOy+g/RKJSfv1GANCRCrvML+iTNt3Csk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042