UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P5OReyZ35GwiSpGrRdgz3nDXg00C9cWJ63JeCVRgCI4=' 
WHERE 
  key_id = 'f5ae69789e711370d7b024349201f00f660f344bffd1feca36caf558320af0c9' 
  AND (
    token = 'P5OReyZ35GwiSpGrRdgz3nDXg00C9cWJ63JeCVRgCI4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032