UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Oh4fhepxvao19YO07tAd3iTJgcsifP+9LxfZvSqPV+c=' 
WHERE 
  key_id = 'dfdce7dfb0053f084c04254f8601f53f3df6a56401f5f416088a05d5251ed62f' 
  AND (
    token = 'Oh4fhepxvao19YO07tAd3iTJgcsifP+9LxfZvSqPV+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035